//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.tuliu.appupdate.updatelib;

import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build.VERSION;
import android.widget.RemoteViews;
import java.util.ArrayList;
import java.util.Iterator;

class NotificationCompat {
    /** @deprecated */
    public static final int FLAG_HIGH_PRIORITY = 128;
    public static final int PRIORITY_DEFAULT = 0;
    public static final int PRIORITY_LOW = -1;
    public static final int PRIORITY_MIN = -2;
    public static final int PRIORITY_HIGH = 1;
    public static final int PRIORITY_MAX = 2;
    private static final NotificationCompat.NotificationCompatImpl IMPL;

    NotificationCompat() {
    }

    static {
        if(VERSION.SDK_INT >= 16) {
            IMPL = new NotificationCompat.NotificationCompatImplJellybean();
        } else if(VERSION.SDK_INT >= 14) {
            IMPL = new NotificationCompat.NotificationCompatImplIceCreamSandwich();
        } else if(VERSION.SDK_INT >= 11) {
            IMPL = new NotificationCompat.NotificationCompatImplHoneycomb();
        } else {
            IMPL = new NotificationCompat.NotificationCompatImplBase();
        }

    }

    public static class Action {
        public int icon;
        public CharSequence title;
        public PendingIntent actionIntent;

        public Action(int icon_, CharSequence title_, PendingIntent intent_) {
            this.icon = icon_;
            this.title = title_;
            this.actionIntent = intent_;
        }
    }

    public static class InboxStyle extends NotificationCompat.Style {
        ArrayList<CharSequence> mTexts = new ArrayList();

        public InboxStyle() {
        }

        public InboxStyle(NotificationCompat.Builder builder) {
            this.setBuilder(builder);
        }

        public NotificationCompat.InboxStyle setBigContentTitle(CharSequence title) {
            this.mBigContentTitle = title;
            return this;
        }

        public NotificationCompat.InboxStyle setSummaryText(CharSequence cs) {
            this.mSummaryText = cs;
            this.mSummaryTextSet = true;
            return this;
        }

        public NotificationCompat.InboxStyle addLine(CharSequence cs) {
            this.mTexts.add(cs);
            return this;
        }
    }

    public static class BigTextStyle extends NotificationCompat.Style {
        CharSequence mBigText;

        public BigTextStyle() {
        }

        public BigTextStyle(NotificationCompat.Builder builder) {
            this.setBuilder(builder);
        }

        public NotificationCompat.BigTextStyle setBigContentTitle(CharSequence title) {
            this.mBigContentTitle = title;
            return this;
        }

        public NotificationCompat.BigTextStyle setSummaryText(CharSequence cs) {
            this.mSummaryText = cs;
            this.mSummaryTextSet = true;
            return this;
        }

        public NotificationCompat.BigTextStyle bigText(CharSequence cs) {
            this.mBigText = cs;
            return this;
        }
    }

    public static class BigPictureStyle extends NotificationCompat.Style {
        Bitmap mPicture;
        Bitmap mBigLargeIcon;
        boolean mBigLargeIconSet;

        public BigPictureStyle() {
        }

        public BigPictureStyle(NotificationCompat.Builder builder) {
            this.setBuilder(builder);
        }

        public NotificationCompat.BigPictureStyle setBigContentTitle(CharSequence title) {
            this.mBigContentTitle = title;
            return this;
        }

        public NotificationCompat.BigPictureStyle setSummaryText(CharSequence cs) {
            this.mSummaryText = cs;
            this.mSummaryTextSet = true;
            return this;
        }

        public NotificationCompat.BigPictureStyle bigPicture(Bitmap b) {
            this.mPicture = b;
            return this;
        }

        public NotificationCompat.BigPictureStyle bigLargeIcon(Bitmap b) {
            this.mBigLargeIcon = b;
            this.mBigLargeIconSet = true;
            return this;
        }
    }

    public abstract static class Style {
        NotificationCompat.Builder mBuilder;
        CharSequence mBigContentTitle;
        CharSequence mSummaryText;
        boolean mSummaryTextSet = false;

        public Style() {
        }

        public void setBuilder(NotificationCompat.Builder builder) {
            if(this.mBuilder != builder) {
                this.mBuilder = builder;
                if(this.mBuilder != null) {
                    this.mBuilder.setStyle(this);
                }
            }

        }

        public Notification build() {
            Notification notification = null;
            if(this.mBuilder != null) {
                notification = this.mBuilder.build();
            }

            return notification;
        }
    }

    public static class Builder {
        Context mContext;
        CharSequence mContentTitle;
        CharSequence mContentText;
        PendingIntent mContentIntent;
        PendingIntent mFullScreenIntent;
        RemoteViews mTickerView;
        Bitmap mLargeIcon;
        CharSequence mContentInfo;
        int mNumber;
        int mPriority;
        boolean mUseChronometer;
        NotificationCompat.Style mStyle;
        CharSequence mSubText;
        int mProgressMax;
        int mProgress;
        boolean mProgressIndeterminate;
        ArrayList<NotificationCompat.Action> mActions = new ArrayList();
        Notification mNotification = new Notification();

        public Builder(Context context) {
            this.mContext = context;
            this.mNotification.when = System.currentTimeMillis();
            this.mNotification.audioStreamType = -1;
            this.mPriority = 0;
        }

        public NotificationCompat.Builder setWhen(long when) {
            this.mNotification.when = when;
            return this;
        }

        public NotificationCompat.Builder setUsesChronometer(boolean b) {
            this.mUseChronometer = b;
            return this;
        }

        public NotificationCompat.Builder setSmallIcon(int icon) {
            this.mNotification.icon = icon;
            return this;
        }

        public NotificationCompat.Builder setSmallIcon(int icon, int level) {
            this.mNotification.icon = icon;
            this.mNotification.iconLevel = level;
            return this;
        }

        public NotificationCompat.Builder setContentTitle(CharSequence title) {
            this.mContentTitle = title;
            return this;
        }

        public NotificationCompat.Builder setContentText(CharSequence text) {
            this.mContentText = text;
            return this;
        }

        public NotificationCompat.Builder setSubText(CharSequence text) {
            this.mSubText = text;
            return this;
        }

        public NotificationCompat.Builder setNumber(int number) {
            this.mNumber = number;
            return this;
        }

        public NotificationCompat.Builder setContentInfo(CharSequence info) {
            this.mContentInfo = info;
            return this;
        }

        public NotificationCompat.Builder setProgress(int max, int progress, boolean indeterminate) {
            this.mProgressMax = max;
            this.mProgress = progress;
            this.mProgressIndeterminate = indeterminate;
            return this;
        }

        public NotificationCompat.Builder setContent(RemoteViews views) {
            this.mNotification.contentView = views;
            return this;
        }

        public NotificationCompat.Builder setContentIntent(PendingIntent intent) {
            this.mContentIntent = intent;
            return this;
        }

        public NotificationCompat.Builder setDeleteIntent(PendingIntent intent) {
            this.mNotification.deleteIntent = intent;
            return this;
        }

        public NotificationCompat.Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {
            this.mFullScreenIntent = intent;
            this.setFlag(128, highPriority);
            return this;
        }

        public NotificationCompat.Builder setTicker(CharSequence tickerText) {
            this.mNotification.tickerText = tickerText;
            return this;
        }

        public NotificationCompat.Builder setTicker(CharSequence tickerText, RemoteViews views) {
            this.mNotification.tickerText = tickerText;
            this.mTickerView = views;
            return this;
        }

        public NotificationCompat.Builder setLargeIcon(Bitmap icon) {
            this.mLargeIcon = icon;
            return this;
        }

        public NotificationCompat.Builder setSound(Uri sound) {
            this.mNotification.sound = sound;
            this.mNotification.audioStreamType = -1;
            return this;
        }

        public NotificationCompat.Builder setSound(Uri sound, int streamType) {
            this.mNotification.sound = sound;
            this.mNotification.audioStreamType = streamType;
            return this;
        }

        public NotificationCompat.Builder setVibrate(long[] pattern) {
            this.mNotification.vibrate = pattern;
            return this;
        }

        public NotificationCompat.Builder setLights(int argb, int onMs, int offMs) {
            this.mNotification.ledARGB = argb;
            this.mNotification.ledOnMS = onMs;
            this.mNotification.ledOffMS = offMs;
            boolean showLights = this.mNotification.ledOnMS != 0 && this.mNotification.ledOffMS != 0;
            this.mNotification.flags = this.mNotification.flags & -2 | (showLights?1:0);
            return this;
        }

        public NotificationCompat.Builder setOngoing(boolean ongoing) {
            this.setFlag(2, ongoing);
            return this;
        }

        public NotificationCompat.Builder setOnlyAlertOnce(boolean onlyAlertOnce) {
            this.setFlag(8, onlyAlertOnce);
            return this;
        }

        public NotificationCompat.Builder setAutoCancel(boolean autoCancel) {
            this.setFlag(16, autoCancel);
            return this;
        }

        public NotificationCompat.Builder setDefaults(int defaults) {
            this.mNotification.defaults = defaults;
            if((defaults & 4) != 0) {
                this.mNotification.flags |= 1;
            }

            return this;
        }

        private void setFlag(int mask, boolean value) {
            if(value) {
                this.mNotification.flags |= mask;
            } else {
                this.mNotification.flags &= ~mask;
            }

        }

        public NotificationCompat.Builder setPriority(int pri) {
            this.mPriority = pri;
            return this;
        }

        public NotificationCompat.Builder addAction(int icon, CharSequence title, PendingIntent intent) {
            this.mActions.add(new NotificationCompat.Action(icon, title, intent));
            return this;
        }

        public NotificationCompat.Builder setStyle(NotificationCompat.Style style) {
            if(this.mStyle != style) {
                this.mStyle = style;
                if(this.mStyle != null) {
                    this.mStyle.setBuilder(this);
                }
            }

            return this;
        }

        /** @deprecated */
        @Deprecated
        public Notification getNotification() {
            return NotificationCompat.IMPL.build(this);
        }

        public Notification build() {
            return NotificationCompat.IMPL.build(this);
        }
    }

    static class NotificationCompatImplJellybean implements NotificationCompat.NotificationCompatImpl {
        NotificationCompatImplJellybean() {
        }

        public Notification build(NotificationCompat.Builder b) {
            NotificationCompatJellybean jbBuilder = new NotificationCompatJellybean(b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon, b.mProgressMax, b.mProgress, b.mProgressIndeterminate, b.mUseChronometer, b.mPriority, b.mSubText);
            Iterator style = b.mActions.iterator();

            while(style.hasNext()) {
                NotificationCompat.Action action = (NotificationCompat.Action)style.next();
                jbBuilder.addAction(action.icon, action.title, action.actionIntent);
            }

            if(b.mStyle != null) {
                if(b.mStyle instanceof NotificationCompat.BigTextStyle) {
                    NotificationCompat.BigTextStyle style1 = (NotificationCompat.BigTextStyle)b.mStyle;
                    jbBuilder.addBigTextStyle(style1.mBigContentTitle, style1.mSummaryTextSet, style1.mSummaryText, style1.mBigText);
                } else if(b.mStyle instanceof NotificationCompat.InboxStyle) {
                    NotificationCompat.InboxStyle style2 = (NotificationCompat.InboxStyle)b.mStyle;
                    jbBuilder.addInboxStyle(style2.mBigContentTitle, style2.mSummaryTextSet, style2.mSummaryText, style2.mTexts);
                } else if(b.mStyle instanceof NotificationCompat.BigPictureStyle) {
                    NotificationCompat.BigPictureStyle style3 = (NotificationCompat.BigPictureStyle)b.mStyle;
                    jbBuilder.addBigPictureStyle(style3.mBigContentTitle, style3.mSummaryTextSet, style3.mSummaryText, style3.mPicture, style3.mBigLargeIcon, style3.mBigLargeIconSet);
                }
            }

            return jbBuilder.build();
        }
    }

    static class NotificationCompatImplIceCreamSandwich implements NotificationCompat.NotificationCompatImpl {
        NotificationCompatImplIceCreamSandwich() {
        }

        public Notification build(NotificationCompat.Builder b) {
            return NotificationCompatIceCreamSandwich.add(b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon, b.mProgressMax, b.mProgress, b.mProgressIndeterminate);
        }
    }

    static class NotificationCompatImplHoneycomb implements NotificationCompat.NotificationCompatImpl {
        NotificationCompatImplHoneycomb() {
        }

        public Notification build(NotificationCompat.Builder b) {
            return NotificationCompatHoneycomb.add(b.mContext, b.mNotification, b.mContentTitle, b.mContentText, b.mContentInfo, b.mTickerView, b.mNumber, b.mContentIntent, b.mFullScreenIntent, b.mLargeIcon);
        }
    }

    static class NotificationCompatImplBase implements NotificationCompat.NotificationCompatImpl {
        NotificationCompatImplBase() {
        }

        public Notification build(NotificationCompat.Builder b) {
            Notification result = b.mNotification;
//            result.setLatestEventInfo(b.mContext, b.mContentTitle, b.mContentText, b.mContentIntent);
//            if(b.mPriority > 0) {
//                result.flags |= 128;
//            }

            return result;
        }
    }

    interface NotificationCompatImpl {
        Notification build(NotificationCompat.Builder var1);
    }
}
